<template>
    <section class="item-right">
        <section class="time-right">
            <span>{{ mytime }}</span>
        </section>
        <img :src="avatar" alt="" class="avatar-right">
        <span v-if="msg" class="msg-right">
            {{ msg }}
        </span>
    </section>
</template>

<script>

    export default {
        name: 'myMsg',
        props: ['msg', 'mytime', 'avatar'],
        computed: {},
        mounted() {

        },
    }
</script>

<style lang="scss" scoped>
    @import 'src/style/mixin';

    .item-right {
        display: block;
        background-color: white;
        height: 3em;
        width: 100%;
        animation: show-chat-odd 0.25s 1 ease-in;
        -moz-animation: show-chat-odd 0.25s 1 ease-in;
        -webkit-animation: show-chat-odd 0.25s 1 ease-in;
        float: right;
    }

    .msg-right {
        margin-top: 0.8em;
        display: inline-block;
        width: 87%;
        text-align: right;

    }

    .item-right ::after {
        position: absolute;
        top: 15px;
        content: '';
        width: 0;
        height: 0;
        border-top: 15px solid #ADD8E6;
        border-right: 15px solid transparent;
        right: -15px;
    }

    .img-right {
        // max-width: 200px;
    }

    span {
        word-break: break-all;
    }

    .time-right {
        // top: -2em;
        @include font(0.5em, 0.5rem, 'PingFangSC-Regular');
        width: 29em;
        height: 1em;
        right: -5.9em;
        text-align: right;
        overflow: hidden;
        position: absolute;
        -ms-text-overflow: ellipsis;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: lighter;
    }

    .avatar-right {
        /* position: absolute; */
        /* top: 0; */
        width: 1.6em;
        height: 1.6em;
        border-radius: 0.1em;
        /* right: 0.5em; */
        margin-right: 0.2em;
        margin-top: 0.7em;
        float: right;
    }

    @keyframes show-chat-odd {
        0% {
            margin-right: -480px;
        }

        100% {
            margin-right: 0;
        }
    }

    @-moz-keyframes show-chat-odd {
        0% {
            margin-right: -480px;
        }

        100% {
            margin-right: 0;
        }
    }

    @-webkit-keyframes show-chat-odd {
        0% {
            margin-right: -480px;
        }

        100% {
            margin-right: 0;
        }
    }
</style>
